<?php

/*
 *Copyright (C), WhiteBlue
 *File name: loader.php
 *Author: Version: 2015.3.9
 *Description: 类加载器
 */

class loader
{
    private static $loaded = array();

    public static function load($object)
    {
        $valid = array(
            "model",
            "router",
            "config",
            "debug"
        );
        if (!in_array($object, $valid)) {
            throw new Exception("未找到对象:'{$object}' ");
        }
        if (empty(self::$loaded[$object])) {
            self::$loaded[$object] = new $object();
        }
        return self::$loaded[$object];
    }
}